import {del, get, post, put} from "@/api/config";


export const searchSchool = (pageParam, searchParam) => get('/school/page', {
    page: pageParam.page,
    size: pageParam.size,
    name: searchParam.name,
    attr: searchParam.attr,
    address: searchParam.address,
    type: searchParam.type
})

export const searchMajor = (pageParam, searchParam) => get('/major/page', {
    page: pageParam.page,
    size: pageParam.size,
    name: searchParam.name,
    level: searchParam.level
})

export const register = (entity) => post('/user/register', entity)

export const login = (entity) => post('/user/login', entity)

// 获取用户信息
export const profile = (id) => get(`/user/${id}`)

// 更新用户信息
export const updateUser = (entity) => put('/user', entity)

// 获取预测列表
export const predictList = (param) => post('/predict/sim', param)

// 根据用户分数进行志愿推荐
export const recommand = (userId) => get(`/predict/recommend/${userId}`)

// 查询用户的推荐列表
export const queryRecommend = (userId) => get(`/recommend/${userId}`)

// 添加收藏
export const addLove = (entity) => post('/love', entity);

// 查询收藏列表
export const listLove = (id) => get(`/love/${id}`);

// 删除收藏
export const deleteLove = (schoolId, userId) => del(`/love/${schoolId}/${userId}`);

// 查询通知公告
export const  listNotices = () => get('/resource/list')

// 保存资源
export const saveResource = (entity) => post('/resource', entity)

// 加载接口
export const loadSchool = (path) => get(`/load/school/${path}`)

// 根据学校搜索专业
export const queryMajorBySchool = (name) => get(`/major/school?name=${encodeURIComponent(name)}`)
